<% severity = item['severity'].downcase
   source   = item['source']
   payload  = item['payload'].delete_blank %>
<li id="item_<%= item['timestamp'] %>" class="severity-<%= severity %>"
    <%= builder[:attributes] || raw(%(timestamp="#{item['timestamp']}" source="#{item['source']}" severity="#{item['severity']}" subject="#{item['subject']}" text="#{item['text']}" date="#{Time.at(item['timestamp']).strftime('%m/%d')}")) %>>
	<div class="head">
		<%= builder[:head] || notification_icon(source) %>
	</div>
	<div class="subject">
    <% if payload.present? %>
      <%= link_to_function(icon('angle-down', '&nbsp;', 'fa-lg'),
                           "$j(this).find('i.fa').toggleClass('fa-angle-down fa-angle-up').parents('li').find('.middle').toggle(500)", :class => 'pull-right') %>
    <% end %>
    <% if builder[:subject] %>
      <%= builder[:subject] %>
    <% else %>
      <%= highlight(item['subject'], severity) %>
    <% end %>
	</div>
	<div class="text">
		<%= builder[:text] || item['text'] %>
    <% if payload.present? %>
      <div class="middle" style="display:none">
        <% builder = lambda do |k, v|
             if k == 'deploymentId'
               link_to(v, redirect_deployment_path(v))
             elsif k == 'ciName'
               cms_id = item['cmsId']
               cms_id.blank? ? v : link_to(v, redirect_ci_url(:only_path => false, :id => cms_id))
             else
               v
             end
           end %>
        <%= render 'base/shared/nested_hash', :data => payload, :builder => builder %>
      </div>
    <% end %>
	</div>
	<div class="time">
		<%= time_ago_in_words(Time.at(item['timestamp'] / 1000)) %>
		<%= source %>
		in
		<%= notification_callback(item) %>
	</div>
</li>
